package cn.stylefeng.guns.modular.transport.service;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.basic.entity.BasicOperate;
import cn.stylefeng.guns.modular.order.model.params.OrderTransportDetailedParam;
import cn.stylefeng.guns.modular.order.model.params.OrderTransportParam;
import cn.stylefeng.guns.modular.transport.entity.TransportDispatch;
import cn.stylefeng.guns.modular.transport.entity.ZhuangyunMingxiTongji;
import cn.stylefeng.guns.modular.transport.entity.peisongfenxi;
import cn.stylefeng.guns.modular.transport.model.params.TransportDispatchParam;
import cn.stylefeng.guns.modular.transport.model.params.TransportReceiptParam;
import cn.stylefeng.guns.modular.transport.model.result.TransportDispatchResult;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
 * <p>
 * 调度单表 服务类
 * </p>
 *
 * @author zhucx
 * @since 2019-08-06
 */
public interface TransportDispatchService extends IService<TransportDispatch> {

    /**
     * 新增
     *
     * @author zhucx
     * @Date 2019-08-06
     */
    void add(TransportDispatchParam param);

    /**
     * 删除
     *
     * @author zhucx
     * @Date 2019-08-06
     */
    void delete(TransportDispatchParam param);

    /**
     * 更新
     *
     * @author zhucx
     * @Date 2019-08-06
     */
    void update(TransportDispatchParam param);

    /**
     * 查询单条数据，Specification模式
     *
     * @author zhucx
     * @Date 2019-08-06
     */
    TransportDispatchResult findBySpec(TransportDispatchParam param);

    /**
     * 查询列表，Specification模式
     *
     * @author zhucx
     * @param token 
     * @Date 2019-08-06
     */
    List<TransportDispatchResult> findCarListBySpec(TransportDispatchParam param,String getUnit, String getLocation, String token,String carState);


	List<TransportDispatchResult> findAutoPrintByDispatchNumber(String dispatchNumber);


    /**
     * 查询分页数据，Specification模式
     *
     * @author zhucx
     * @Date 2019-08-06
     */
     LayuiPageInfo findPageBySpec(TransportDispatchParam param,String condition,TransportReceiptParam transportReceiptParam);

     /**
      * 查询车辆 已配详情
      * @param orderTransportParam
      * @return
      */
	List<TransportDispatchResult> findDispatchListBySpec(TransportDispatchParam orderTransportParam,String token);

	/**
	 * 查询已配 商品详情
	 * @param orderTransportParam
	 * @param token
	 * @return
	 */
	List<TransportDispatchResult> findgoodslistBySpec(TransportDispatchParam orderTransportParam,String getUnit, String getLocation, String token,String carState);

	/**
	 * 修改分配货物
	 * @param _list
	 * @param carnumbger
	 * @param data
	 * @return
	 */
	ResponseData editAssign(List<OrderTransportDetailedParam> _list, String carnumbger, ResponseData data);

	/**
	 * 移除车辆
	 * @param carnumbger
	 * @param data
	 * @return
	 */
	ResponseData removeCarBySpecNew(String getUnit,String getLocation, String carnumbger, ResponseData data);

	/**
	 * 通过单号查询  不等于的
	 * 返回条数
	 * @param token
	 * @return
	 */
	Integer findgoodslistNottransportNumber(TransportDispatchParam tdp, String token);
	
	/**
     * APP车辆选择
     * 查询已配置车辆
     * @author zhucx
     * @Date 2019-08-6
     */
	List<TransportDispatchResult> findCarListBySpecToo(TransportDispatchParam orderTransportParam, String getUnit,
			String getLocation, String token,String carState,String dispatch,Long operateId);

	List<TransportDispatchResult> findCarListBySpecToo2(TransportDispatchParam orderTransportParam, String getUnit,
													   String getLocation, String token,String carState,String dispatch,Long operateId);

	List<TransportDispatchResult> findCarListBySpecToo4(TransportDispatchParam orderTransportParam, String getUnit,
			String getLocation, String token,String carState,String dispatch,Long operateId);

	List<TransportDispatchResult> findCarListBySpecYunShuZhongToo(TransportDispatchParam orderTransportParam, String token,String carState,String dispatch,Long operateId);

	LayuiPageInfo findCarListBySpecToo2Page(TransportDispatchParam orderTransportParam, String getUnit,
			String getLocation, String token,String carState,String dispatch,Long operateId);
	
	LayuiPageInfo findCarPageListBySpecToo(TransportDispatchParam orderTransportParam, String getUnit,
			String getLocation, String token,String carState,String dispatch,Long operateId);


	/**
	 * 查询已配 商品详情
	 * @return
	 */
	List<TransportDispatchResult> findgoodslist(TransportDispatchParam orderTransportParam);

	List<TransportDispatchResult> findListBySpec(TransportDispatchParam param);

	List<TransportDispatchResult> findListByCarIsNull(TransportDispatchParam param);

	List<TransportDispatchResult> findOrderListBySpec(TransportDispatchParam transportDispatchParam, String token,Long operateId);

	List<TransportDispatchResult> findOrderListBySpecNew(TransportDispatchParam transportDispatchParam, String token,Long operateId);

	List<TransportDispatchResult> findLineListBySpec(TransportDispatchParam transportDispatchParam, String token,Long operateId);

	List<TransportDispatchResult> findLineListBySpecNew(TransportDispatchParam transportDispatchParam, String token,Long operateId);

	List<TransportDispatchResult> findLineGetUnitListBySpecNew(TransportDispatchParam transportDispatchParam, String token,Long operateId);


	List<TransportDispatchResult> findGetUnitListBySpec(TransportDispatchParam transportDispatchParam, String token,Long operateId);

	/**
	 * 移除订单
	 * @param transportNumber
	 * @param carnumbger
	 * @param data
	 * @return
	 */
	ResponseData removeOrderNew(String transportNumber, String carnumbger, ResponseData data);

	/**
	 * 移除商品
	 * @param transportNumber
	 * @param goodsId
	 * @param carnumbger
	 * @param data
	 * @return
	 */
	ResponseData removeGoods(String transportNumber, Long goodsId, String carnumbger, ResponseData data);

	/**
	 * 修改调度单号
	 * @param transportDispatchParam
	 */
	void updateDispatchNumber(TransportDispatchParam param,Long operateId);

	List<TransportDispatchResult> findbydispatchmumber(TransportDispatchParam orderTransportParam);

	/**
	 * 通过调度单号，收货单位id，收货地址id
	 * 合计数量，体积
	 * 按货运订单分组
	 * @param TransportDispatchParam
	 * @param getUnitId
	 * @param getLocationId
	 * @return
	 */
	List<TransportDispatchResult> sumBySpec(TransportDispatchParam param, Long getUnitId, Long getLocationId);

	/**
	 * 分配货物
	 */
	ResponseData assignNew(List<OrderTransportDetailedParam> _list, Long carId,String dispatchNumber, ResponseData data, User user,boolean calculateShippingCost);

	List<TransportDispatchResult> findNotByCarnumber(TransportDispatchParam param);

	LayuiPageInfo findCarListBySpecTooPage(TransportDispatchParam transportDispatchParam,String dispatch,Long operateId);

	List<TransportDispatchResult> findPrintlistSpec(TransportDispatchParam transportDispatchParam,
			TransportReceiptParam transportReceiptParam);

	List<ZhuangyunMingxiTongji> findchengyunshangMingxiCount(TransportDispatchParam transportDispatchParam,String condition,String getUnit,String times,Long operateId,Long operateId2);

	List<ZhuangyunMingxiTongji> findchengyunshangMingxiAll(TransportDispatchParam transportDispatchParam,String condition,String getUnit,String times,Long operateId,Long operateId2);

	LayuiPageInfo findchengyunshangMingxiPage(TransportDispatchParam transportDispatchParam,String condition,String getUnit,String times,Long operateId,Long operateId2);

	LayuiPageInfo findCarrierRecDetailPage(TransportDispatchParam transportDispatchParam,String condition,String getUnit,String times,Long operateId,Long operateId2);

	List<ZhuangyunMingxiTongji> findCarrierRecDetailAll(TransportDispatchParam transportDispatchParam,String condition,String getUnit,String times,Long operateId,Long operateId2);

	LayuiPageInfo findCarrierRecFeePage(TransportDispatchParam transportDispatchParam,String condition,String times,Long operateId,Long operateId2);

	LayuiPageInfo findTmpCarAppExa(TransportDispatchParam transportDispatchParam,String condition,String times,Long operateId,Long operateId2);

	LayuiPageInfo findTmpCarTb(TransportDispatchParam transportDispatchParam,String condition,String times,Long operateId,Long operateId2);

	List<ZhuangyunMingxiTongji> findCarrierRecFeeAll(TransportDispatchParam transportDispatchParam,String condition,String times,Long operateId,Long operateId2);


	List<ZhuangyunMingxiTongji> findchengyunshangGetUnitCount(TransportDispatchParam transportDispatchParam,String condition,String getUnit,String times,Long operateId,Long operateId2);

	LayuiPageInfo findchengyunshangGetUnitCountPage(TransportDispatchParam transportDispatchParam,String condition,String getUnit,String times,Long operateId,Long operateId2);

	List<ZhuangyunMingxiTongji> findchengyunshangGetUnitCountAll(TransportDispatchParam transportDispatchParam,String condition,String getUnit,String times,Long operateId,Long operateId2);


	ResponseData removeDispatchNumberBySpec(String dispatchNumber, ResponseData data,User user);

	ResponseData jsfy(String ids);

	/**
	 * 删除派车单 商品
	 * @param transportDispatchParam
	 * @param data
	 * @return
	 */
	ResponseData removeGoodsDispatch(TransportDispatchParam transportDispatchParam, ResponseData data,User user);

	TransportDispatchResult findBySpecNotEqId(TransportDispatchParam param);

	TransportDispatchResult sumBySpec2(OrderTransportParam param, Long getLocationId);

	/**
	 * 修改派车单 商品
	 * @param transportDispatchParam
	 * @param data
	 * @return
	 */
	ResponseData editGoodsDispatch(TransportDispatchParam transportDispatchParam, ResponseData data,User user);

	/**
	 * 调整派车单 商品
	 * @param transportDispatchParam
	 * @param data
	 * @return
	 */
	ResponseData tiaozhengGoodsDispatch(TransportDispatchParam transportDispatchParam, ResponseData data,User user);

	/**
	 * 追加明细
	 * @param _list2
	 * @param dispatchNumber
	 * @param data
	 * @param user
	 * @return
	 */
	ResponseData batchassignNewDispatchNumber(List<OrderTransportDetailedParam> _list2, String dispatchNumber,
			ResponseData data, User user);

	ResponseData assignNewDispatchNumber(List<OrderTransportDetailedParam> _list2, Long carId, ResponseData data,
			User user,String dispatchNumber,boolean calculateShippingCost);
	/**
	 * 删除派车单 订单
	 * @param transportDispatchParam
	 * @param data
	 * @return
	 */
	ResponseData removeCustomerOrderDispatch(TransportDispatchParam transportDispatchParam, ResponseData data);

	TransportDispatchResult findBySpecNotEqCustomerOrder(TransportDispatchParam transportDispatchParam);

	/**
	 * 修改派车 明细
	 * @param transportDispatchParam
	 * @param data
	 * @return
	 */
	ResponseData editGoods(TransportDispatchParam transportDispatchParam, ResponseData data);

	TransportDispatchResult findBySpecDispatchNumberIsnull(TransportDispatchParam param);

	TransportDispatchResult findByCarIsNull(TransportDispatchParam param,Long operateId);

	ResponseData removeCarBySpecNewWeb(String carnumbger, ResponseData data, User user);

	List<TransportDispatchResult> findgoodslistBySpecWeb(TransportDispatchParam transportDispatchParam, String token,Long operateId);

	ResponseData removeGoodsWeb(String transportNumber, Long goodsId, String carnumbger, ResponseData data, User user);

	ResponseData editGoodsWeb(TransportDispatchParam transportDispatchParam, ResponseData data);

	ResponseData startCarGoods(TransportDispatchParam transportDispatchParam);

	List<peisongfenxi> findPeisongfenxi(TransportDispatchParam transportDispatchParam, String condition,
			String getUnit, String times,Long operateId,Long operateId2);

	LayuiPageInfo findPeisongfenxiPage(TransportDispatchParam transportDispatchParam, String condition,
										String getUnit, String times,Long operateId,Long operateId2);

	List<TransportDispatchResult> findListBySpecXianggui(TransportDispatchParam param);

	List<TransportDispatchResult> findPrintlistBySpec(TransportReceiptParam transportReceiptParam);

	TransportDispatchResult sumMatrixingNumberByCarrierId(TransportDispatchParam dispatchParam);

	List<ZhuangyunMingxiTongji> findPeisongjindu(TransportDispatchParam transportDispatchParam, String condition,
			String times, Long operateId, Long operateId2);

	List<TransportDispatchResult> findClListBySpec(TransportDispatchParam clParam);

	ResponseData batchassign_driver(List<OrderTransportDetailedParam> _list, Long carId,
			String loadingType, String[] loadingNumbers,User user,BasicOperate basicOperate,String scanDress);

	ResponseData batchassign_app(List<OrderTransportDetailedParam> _list, Long carId, User user);

	ResponseData batchassign_web(List<OrderTransportDetailedParam> _list, Long carId, User user);

	List<TransportDispatchResult> findCarListBySpecYunShuZhongTooGetUnit(TransportDispatchParam transportDispatchParam,
			String dispatch, Long operateId);

	ResponseData batchassignNewDispatchNumber_driver(List<OrderTransportDetailedParam> _list2, String dispatchNumber,
			ResponseData data, User user, BasicOperate basicOperate,String scanDress);

	LayuiPageInfo findPpPageBySpec(TransportDispatchParam transportDispatchParam, String condition, Long operateId);

	Integer countGetUnit(TransportDispatchParam countppp);

	List<TransportDispatchResult> findSumGoodsBySpec(TransportDispatchParam transportDispatchParam);

	TransportDispatchResult findClZjSumBySpec(String dispatchNumber);

	List<TransportDispatchResult> findHxprintListBySpec(TransportDispatchParam transportDispatchParam);

	List<TransportDispatchResult> findHxLmAssociationOrder(TransportDispatchParam transportDispatchParam);

	TransportDispatchResult findClZjunitSumBySpec(String dispatchNumber, Long getLocationId);

	TransportDispatchResult findClZjunitSumPrintBySpec(String dispatchNumber, Long getLocationId);

}
